package com.jtlrm.ckd.util.ContactList;

import android.content.Context;
import android.util.AttributeSet;

import com.jtlrm.ckd.mvp.view.api.SelectInterface;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

public class PicContactsView extends ContactListView {
    public PicContactsView(Context context) {
        super(context);
    }

    public PicContactsView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public PicContactsView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected ContactAdapter getAdapter() {
        return new PicContactsAdapter(context, 0, new ArrayList<>(contactList));
    }

    /**
     * 选中所有
     */
    public void selectAll() {
        if (adapter != null) {
            ((PicContactsAdapter) adapter).selectAll();
        }
    }

    public void clearAll() {
        if (adapter != null) {
            ((PicContactsAdapter) adapter).clearAll();
        }
    }

    public void setCantEditMembers(Set<Integer> cantEditMembers) {
        if (adapter != null) {
            ((PicContactsAdapter) adapter).setCantEditMembers(cantEditMembers);
        }
    }

    public void setExistMember(Set<SlideBarEntity> cantEditMembers) {
        if (adapter != null) {
            ((PicContactsAdapter) adapter).setExistMembers(cantEditMembers);
        }
    }

    public Set<SlideBarEntity> getExistMembers() {
        if (adapter != null) {
            return ((PicContactsAdapter) adapter).getExistMembers();
        } else {
            return null;
        }
    }

    public void setSelectInterface(SelectInterface selectInterface) {
        if (adapter != null) {
            ((PicContactsAdapter) adapter).setSelectInterface(selectInterface);
        }
    }
}
